package com.ms.controller;

import com.ms.common.Result;
import com.ms.pojo.Resign_apply;
import com.ms.service.UserResignService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "员工提交离职申请接口")
@RestController
@RequestMapping("/userResign")
public class UserResignController {
    @Autowired
    private UserResignService userResignService;

    @PostMapping("/insertResignApply")
    @Operation(summary = "员工申请离职信息接口")
    public Result<String> insertResignApply(@Valid @RequestBody Resign_apply resign_apply) {
        int result = userResignService.insertResignApply(resign_apply);
        if (result > 0) {
            return Result.success("离职申请提交成功");
        } else {
            return Result.error("离职申请提交失败");
        }
    }
}
